package controllers

import (
	"ck-go-test/service"
	"github.com/gin-gonic/gin"
	"net/http"
)

func GetName(c *gin.Context) {

	id := c.Param("id")
	r := service.User{ID: id}
	name, err := r.GetName()
	if nil != err {
		c.String(http.StatusInternalServerError, err.Error())
		return
	}
	c.JSON(http.StatusOK, gin.H{"error": "ok", "name": name})
}
